﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;

namespace DataTransferObject.MetaDataList
{
    public class ListCustomerNameMaster : NotifyPropertyChangeObject
    {
        private int customerID;

        private DateTime entryDate;

        private int customerCategoryID;
        private int customerTypeID;
        private int salesmenID;
        private int addressAreaID;
        private int distributorID;
        private int customerGroupID;
        private int masterCustomerID;
        private int customerChannelID;

        private string description;
        private string descriptionOfficial;
        private string descriptionOriginal;
        private string vatCode;
        private string contactName;
        private string attentionName;
        private string telephone;
        private string emailAddress;
        private string addressNo;
        private string addressStreet;
        private string other;

        private bool inActive;
        private bool dependentOnly;
        private bool isMasterCustomer;
        private bool isTenderCustomer;


        public ListCustomerNameMaster()
        {
            GlobalDefaultValue.Apply(this);
            this.EntryDate = DateTime.Now;
        }

        #region Properties


        [DefaultValue(-1)]
        public int CustomerID
        {
            get { return this.customerID; }
            set { ApplyPropertyChange<ListCustomerNameMaster, int>(ref this.customerID, o => o.CustomerID, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime EntryDate
        {
            get { return this.entryDate; }
            set { ApplyPropertyChange<ListCustomerNameMaster, DateTime>(ref this.entryDate, o => o.EntryDate, value); }
        }


        //[DefaultValue(-1)]
        public int CustomerCategoryID
        {
            get { return this.customerCategoryID; }
            set { ApplyPropertyChange<ListCustomerNameMaster, int>(ref this.customerCategoryID, o => o.CustomerCategoryID, value); }
        }

        //[DefaultValue(-1)]
        public int CustomerTypeID
        {
            get { return this.customerTypeID; }
            set { ApplyPropertyChange<ListCustomerNameMaster, int>(ref this.customerTypeID, o => o.CustomerTypeID, value); }
        }

        //[DefaultValue(-1)]
        public int SalesmenID
        {
            get { return this.salesmenID; }
            set { ApplyPropertyChange<ListCustomerNameMaster, int>(ref this.salesmenID, o => o.SalesmenID, value); }
        }

        //[DefaultValue(-1)]
        public int AddressAreaID
        {
            get { return this.addressAreaID; }
            set { ApplyPropertyChange<ListCustomerNameMaster, int>(ref this.addressAreaID, o => o.AddressAreaID, value); }
        }

        //[DefaultValue(-1)]
        public int DistributorID
        {
            get { return this.distributorID; }
            set { ApplyPropertyChange<ListCustomerNameMaster, int>(ref this.distributorID, o => o.DistributorID, value); }
        }

        //[DefaultValue(-1)]
        public int CustomerGroupID
        {
            get { return this.customerGroupID; }
            set { ApplyPropertyChange<ListCustomerNameMaster, int>(ref this.customerGroupID, o => o.CustomerGroupID, value); }
        }

        [DefaultValue(-1)]
        public int MasterCustomerID
        {
            get { return this.masterCustomerID; }
            set { ApplyPropertyChange<ListCustomerNameMaster, int>(ref this.masterCustomerID, o => o.MasterCustomerID, value); }
        }

        //[DefaultValue(-1)]
        public int CustomerChannelID
        {
            get { return this.customerChannelID; }
            set { ApplyPropertyChange<ListCustomerNameMaster, int>(ref this.customerChannelID, o => o.CustomerChannelID, value); }
        }

        [DefaultValue("********")]
        public string Description
        {
            get { return this.description; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.description, o => o.Description, value); }
        }

        [DefaultValue("")]
        public string DescriptionOfficial
        {
            get { return this.descriptionOfficial; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.descriptionOfficial, o => o.DescriptionOfficial, value); }
        }

        [DefaultValue("")]
        public string DescriptionOriginal
        {
            get { return this.descriptionOriginal; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.descriptionOriginal, o => o.DescriptionOriginal, value); }
        }

        [DefaultValue("")]
        public string VATCode
        {
            get { return this.vatCode; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.vatCode, o => o.VATCode, value); }
        }

        [DefaultValue("")]
        public string ContactName
        {
            get { return this.contactName; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.contactName, o => o.ContactName, value); }
        }

        [DefaultValue("")]
        public string AttentionName
        {
            get { return this.attentionName; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.attentionName, o => o.AttentionName, value); }
        }

        [DefaultValue("")]
        public string Telephone
        {
            get { return this.telephone; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.telephone, o => o.Telephone, value); }
        }

        [DefaultValue("")]
        public string EMailAddress
        {
            get { return this.emailAddress; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.emailAddress, o => o.EMailAddress, value); }
        }

        [DefaultValue("")]
        public string AddressNo
        {
            get { return this.addressNo; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.addressNo, o => o.AddressNo, value); }
        }

        [DefaultValue("")]
        public string AddressStreet
        {
            get { return this.addressStreet; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.addressStreet, o => o.AddressStreet, value); }
        }

        [DefaultValue("")]
        public string Other
        {
            get { return this.other; }
            set { ApplyPropertyChange<ListCustomerNameMaster, string>(ref this.other, o => o.Other, value); }
        }

        [DefaultValue(false)]
        public bool InActive
        {
            get { return this.inActive; }
            set { ApplyPropertyChange<ListCustomerNameMaster, bool>(ref this.inActive, o => o.InActive, value); }
        }

        [DefaultValue(false)]
        public bool DependentOnly
        {
            get { return this.dependentOnly; }
            set { ApplyPropertyChange<ListCustomerNameMaster, bool>(ref this.dependentOnly, o => o.DependentOnly, value); }
        }

        [DefaultValue(false)]
        public bool IsMasterCustomer
        {
            get { return this.isMasterCustomer; }
            set { ApplyPropertyChange<ListCustomerNameMaster, bool>(ref this.isMasterCustomer, o => o.IsMasterCustomer, value); }
        }

        [DefaultValue(false)]
        public bool IsTenderCustomer
        {
            get { return this.isTenderCustomer; }
            set { ApplyPropertyChange<ListCustomerNameMaster, bool>(ref this.isTenderCustomer, o => o.IsTenderCustomer, value); }
        }


        #endregion

        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("Description", "Description cannot be blank.", delegate { return this.Description.Length != 0; }));
            validationRules.Add(new SimpleValidationRule("DescriptionOfficial", "Description official cannot be blank.", delegate { return this.DescriptionOfficial.Length != 0; }));
            validationRules.Add(new SimpleValidationRule("CustomerCategoryID", "Customer class cannot be empty.", delegate { return (this.CustomerCategoryID > 0); }));
            validationRules.Add(new SimpleValidationRule("CustomerTypeID", "Customer channel cannot be empty.", delegate { return (this.CustomerTypeID > 0); }));
            validationRules.Add(new SimpleValidationRule("CustomerChannelID", "Customer channel 2 cannot be empty.", delegate { return (this.CustomerChannelID > 0); }));
            validationRules.Add(new SimpleValidationRule("CustomerGroupID", "Customer group cannot be empty.", delegate { return (this.CustomerGroupID > 0); }));
            validationRules.Add(new SimpleValidationRule("AddressAreaID", "Territory cannot be empty.", delegate { return (this.AddressAreaID > 0); }));
            validationRules.Add(new SimpleValidationRule("SalesmenID", "Salesmen cannot be empty.", delegate { return (this.SalesmenID > 0); }));

            return validationRules;
        }
    }
}
